<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS函数</title>
</head>
<body>
    <script>
        function hello(){
            console.log('hello,world!')
        }
        hello();

        function hello_with_return(){
            return 'hello,world';
        }

        let x = hello_with_return();
        console.log(x);

        function hello_with_params(name){
            console.log("hello,"+ name);
        }

        hello_with_params("如花");
        
        // 作用域

        let global_var = '全局变量';
        function local_var_function(){
            let local_var = '局部变量';
            console.log("函数内打印全局变量：" + global_var);
            console.log("函数内打印局部变量：" + local_var);
        }

        local_var_function();
    </script>
</body>
</html>